package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 改密
 */
public class ChangePwdPanel extends JPanel implements ActionListener {
    private AtmGUI atmGUI;
    private JLabel pwdLabel = new JLabel("请输入原密码：");
    private JTextField pwdTextField = new JTextField();
    private JLabel pwdLabel1 = new JLabel("请输入新密码：");
    private JTextField pwdTextField1 = new JTextField();
    private JLabel pwdLabel2 = new JLabel("请再输入新密码：");
    private JTextField pwdTextField2 = new JTextField();
    private Font font = new Font("宋体",Font.BOLD,18);
    private JButton sureBtn = new JButton(new ImageIcon("images\\buttonSure.jpg"));
    private JButton offBtn = new JButton(new ImageIcon("images\\buttonOff.jpg"));
    public ChangePwdPanel(AtmGUI atmGUI){
        this.atmGUI = atmGUI;
        this.setLayout(null);
        this.setOpaque(false);
        pwdLabel.setBounds(300,200,300,50);
        pwdLabel.setFont(font);
        this.add(pwdLabel);
        pwdTextField.setBounds(500,200,200,50);
        pwdTextField.setFont(font);
        this.add(pwdTextField);
        pwdLabel1.setBounds(300,300,300,50);
        pwdLabel1.setFont(font);
        this.add(pwdLabel1);
        pwdTextField1.setBounds(500,300,200,50);
        pwdTextField1.setFont(font);
        this.add(pwdTextField1);
        pwdLabel2.setBounds(300,400,300,50);
        pwdLabel2.setFont(font);
        this.add(pwdLabel2);
        pwdTextField2.setBounds(500,400,200,50);
        pwdTextField2.setFont(font);
        this.add(pwdTextField2);
        sureBtn.setBounds(800,400,140,50);
        sureBtn.addActionListener(this);
        this.add(sureBtn);
        offBtn.setBounds(0,400,140,50);
        offBtn.addActionListener(this);
        this.add(offBtn);
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == sureBtn){
            atmGUI.showPanel("menu");
        }else if (e.getSource() == offBtn){
            atmGUI.showPanel("login");
        }

    }
    }

